package com.edais.rabbit;

import java.util.Map;

import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.edais.service.ThirdProductRouteService;
import com.edais.util.JsonUtil;

/**
 * 提现查询处理
 * 
 * @author aohj
 *
 */
@Service("rabbitListener")
public class RabbitWithDrawConsumer implements RabbitConsumer<byte[]> {
	private static final Logger logger = Logger
			.getLogger(RabbitWithDrawConsumer.class);

	@Autowired
	private ThirdProductRouteService thirdProductRouteService;
	
	/* (non-Javadoc)
	 * @see com.edais.rabbit.RabbitConsumer#accept(java.lang.Object)
	 */
	@Override
	public void accept(byte[] bytes) {
		try {
			String message = new String(bytes, "utf-8");
			logger.info("rabbit接收到数据" + message);
			Map<String, Object> queryResultMap = JsonUtil.getMapFromJsonString(message);
			thirdProductRouteService.queryResult(queryResultMap);
		} catch (Exception e) {
			logger.error("rabbit处理消息异常");
		}
	}
}